package top.chmin.project.cloud.common.dict.type.auto;

// field import auto
// #bind.field.id#

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import top.chmin.project.cloud.common.entity.*;

/**
 * chmin
 * 2023-12-27 16:04:10
 * cloud-builder
 */
@Getter
@Setter
@Accessors(chain = true)
public class DictType extends Model {

    // field auto
// #bind.field.dictCode#
    // 字典编码
    private String dictCode;
// $bind.field.dictCode$

// #bind.field.dictName#
    // 字典名称
    private String dictName;
// $bind.field.dictName$


    @Override
    public DictTypeEPC getPreCondition() {
        return new DictTypeEPC();
    }

    public class DictTypeEPC extends PreCondition {
        private DictTypeEPC() {
        }

        private DictTypeEPC(DictTypeEPC parent) {
            super(parent);
        }

        public DictTypeEPC forUpdate() {
            addUpdateSql("update_time = ?", updateTime);
            addUpdateSql("update_by = ?", updateBy);
// field update auto
// #bind.field.dictCode#
            addUpdateSql("dict_code = ?", dictCode);
// $bind.field.dictCode$

// #bind.field.dictName#
            addUpdateSql("dict_name = ?", dictName);
// $bind.field.dictName$

            type = "UPDATE";
            return this;
        }

        public DictTypeEPC forDelete() {
            type = "DELETE";
            return this;
        }

        public DictTypeEPC forCount() {
            type = "COUNT";
            return this;
        }

        public DictTypeEPC sub() {
            return new DictTypeEPC(this);
        }

        public DictTypeEPC complete(boolean and) {
            finish(and);
            return parent == null ? this : (DictTypeEPC) parent;
        }

        public DictTypeFPC toFlex() {
            DictTypeFPC flex = new DictTypeFPC();
            flex.setUpdateSqlList(updateSqlList);
            flex.setUpdateValueList(updateValueList);
            flex.setSqlList(sqlList);
            flex.setValueList(valueList);
            flex.setType(type);
            return flex;
        }

        public Condition toCondition() {
            return toCondition(DictType.class, "cm_dict_type");
        }

        // field epc auto
// #bind.field.id#
        public Id id() {
            return new Id();
        }

        // #bind.field.dictCode#
        public DictCode dictCode() {
            return new DictCode();
        }
// $bind.field.id$

        // #bind.field.createBy#
        public CreateBy createBy() {
            return new CreateBy();
        }

        // #bind.field.dictName#
        public DictName dictName() {
            return new DictName();
        }
// $bind.field.createBy$

        // #bind.field.updateBy#
        public UpdateBy updateBy() {
            return new UpdateBy();
        }

        public class Id extends LongEPCField<DictTypeEPC> {
            private Id() {
                super(DictTypeEPC.this, "id", id);
            }
        }
// $bind.field.updateBy$

        // #bind.field.createTime#
        public CreateTime createTime() {
            return new CreateTime();
        }

        public class CreateBy extends StringEPCField<DictTypeEPC> {
            private CreateBy() {
                super(DictTypeEPC.this, "create_by", createBy);
            }
        }
// $bind.field.createTime$

        // #bind.field.updateTime#
        public UpdateTime updateTime() {
            return new UpdateTime();
        }

        public class UpdateTime extends LocalDateTimeEPCField<DictTypeEPC> {
            private UpdateTime() {
                super(DictTypeEPC.this, "update_time", updateTime);
            }
        }
// $bind.field.updateTime$

        public class UpdateBy extends StringEPCField<DictTypeEPC> {
            private UpdateBy() {
                super(DictTypeEPC.this, "update_by", updateBy);
            }
        }

        public class CreateTime extends LocalDateTimeEPCField<DictTypeEPC> {
            private CreateTime() {
                super(DictTypeEPC.this, "create_time", createTime);
            }
        }
// $bind.field.dictCode$

        public class DictCode extends StringEPCField<DictTypeEPC> {
            private DictCode() {
                super(DictTypeEPC.this, "dict_code", dictCode);
            }
        }

        public class DictName extends StringEPCField<DictTypeEPC> {
            private DictName() {
                super(DictTypeEPC.this, "dict_name", dictName);
            }
        }
// $bind.field.dictName$

    }
}
